package main

import (
	"fmt"
	"os"
	"problems"
)

func main()  {
	args := os.Args
	if len(args) != 2 {
		fmt.Println("请输入运行的题目号, 如：100")
	}

	switch args[1] {
	case "1":
		q1Run()
		break

	case "2":
		q2Run()
		break

	case "3":
		q3Run()
		break

	case "4":
		q4Run()
		break

	case "5":
		q5Run()
		break

	}

	fmt.Println("运行结束...")
}

func q5Run()  {
	s := "babad"
	r := problems.Q5LongestPalindromicSubstring(s)
	fmt.Println(r)
}


//4、寻找两个正序数组的中位数
func q4Run()  {
	nums1 := []int{1, 2}
	nums2 := []int{3, 4}

	r := problems.Q4MedianOfTwoSortedArrays(nums1, nums2)
	fmt.Println(r)
}


//3、无重复字符的最长子串
func q3Run()  {

}

//2、计算两数相加
func q2Run()  {
	l1 := problems.CreateNode([]int{9,9,9,9,9,9,9})
	l2 := problems.CreateNode([]int{9,9,9,9})


	l := problems.Q2AddTwoNumbers(l1, l2)
	problems.ShowNode(l)
}

//1、两数之和
func q1Run()  {
	r := problems.Q1TwoSum([]int{3, 2, 4}, 6)
	fmt.Println(r)	//[1, 2]
}



